package com.ruoyi.web.controller.cems;

import com.ruoyi.cems.domain.BmsEvcBelongOfficeContact;
import com.ruoyi.cems.service.IBmsEvcBelongOfficeContactService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 属地应急办联络;Controller
 * 
 * @author ruoyi
 * @date 2024-07-22
 */
@RestController
@RequestMapping("/cems/evcBelongOfficeContact")
public class BmsEvcBelongOfficeContactController extends BaseController
{
    @Autowired
    private IBmsEvcBelongOfficeContactService bmsEvcBelongOfficeContactService;

    /**
     * 查询属地应急办联络;列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BmsEvcBelongOfficeContact bmsEvcBelongOfficeContact)
    {
        startPage();
        List<BmsEvcBelongOfficeContact> list = bmsEvcBelongOfficeContactService.selectBmsEvcBelongOfficeContactList(bmsEvcBelongOfficeContact);
        return getDataTable(list);
    }

    /**
     * 导出属地应急办联络;列表
     */
    @Log(title = "属地应急办联络;", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BmsEvcBelongOfficeContact bmsEvcBelongOfficeContact)
    {
        List<BmsEvcBelongOfficeContact> list = bmsEvcBelongOfficeContactService.selectBmsEvcBelongOfficeContactList(bmsEvcBelongOfficeContact);
        ExcelUtil<BmsEvcBelongOfficeContact> util = new ExcelUtil<BmsEvcBelongOfficeContact>(BmsEvcBelongOfficeContact.class);
        util.exportExcel(response, list, "属地应急办联络;数据");
    }

    /**
     * 获取属地应急办联络;详细信息
     */
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") String ID)
    {
        return success(bmsEvcBelongOfficeContactService.selectBmsEvcBelongOfficeContactByID(ID));
    }

    /**
     * 新增属地应急办联络;
     */
    @Log(title = "属地应急办联络;", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BmsEvcBelongOfficeContact bmsEvcBelongOfficeContact)
    {
        return toAjax(bmsEvcBelongOfficeContactService.insertBmsEvcBelongOfficeContact(bmsEvcBelongOfficeContact));
    }

    /**
     * 修改属地应急办联络;
     */
    @Log(title = "属地应急办联络;", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BmsEvcBelongOfficeContact bmsEvcBelongOfficeContact)
    {
        return toAjax(bmsEvcBelongOfficeContactService.updateBmsEvcBelongOfficeContact(bmsEvcBelongOfficeContact));
    }

    /**
     * 删除属地应急办联络;
     */
    @Log(title = "属地应急办联络;", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable String[] IDs)
    {
        return toAjax(bmsEvcBelongOfficeContactService.deleteBmsEvcBelongOfficeContactByIDs(IDs));
    }
}
